﻿/*********************************************************************************
**                                                                              **
**  Copyright (C) 2022-2022 LiLong                                              **
**  This file is part of BluetoothCpp.                                          **
**                                                                              **
**  BluetoothCpp is free software: you can redistribute it and/or modify        **
**  it under the terms of the GNU Lesser General Public License as published by **
**  the Free Software Foundation, either version 3 of the License, or           **
**  (at your option) any later version.                                         **
**                                                                              **
**  BluetoothCpp is distributed in the hope that it will be useful,             **
**  but WITHOUT ANY WARRANTY; without even the implied warranty of              **
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               **
**  GNU Lesser General Public License for more details.                         **
**                                                                              **
**  You should have received a copy of the GNU Lesser General Public License    **
**  along with BluetoothCpp.  If not, see <https://www.gnu.org/licenses/>.      **
**********************************************************************************/
#pragma once

#ifdef WIN32
#include "AbstractPlatformSocket.h"

#include <memory>

namespace BTH
{
class SocketWin : public AbstractPlatformSocket
{
public:
    SocketWin();
    SocketWin(Handle handle);
    ~SocketWin();

    void connect(const Address& addr, const Uuid& uuid) override;
    void send(const char* buffer, int size) override;
    void close() override;
    std::string read(int maxSize) override;
    Handle handle() const override;
    void setSendTimeout(const std::chrono::milliseconds& msec) override;
    void setRecvTimeout(const std::chrono::milliseconds& msec) override;

private:
    struct Impl;
    std::unique_ptr<Impl> m_impl;
};
} // namespace BTH

#endif
